package com.wnxy.f_confirm;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 死信消费者
 */
@Component
public class DLQConsumer {

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "queue-dlx"),
            exchange = @Exchange(name = "exchange-dlx",type = ExchangeTypes.TOPIC),
            key = "dlx.#"
    ))
    public void handlerDeadLetterQueue(String message) {
        System.out.println("死信消费者，消费死信队列的消息：" + message);
        // 手动确认....
    }
}
